package scala.day03

import java.io.{FileNotFoundException, FileReader}

object Demo11Exception {
  def main(args: Array[String]): Unit = {
    /**
      * 异常处理(case)
      */
    try{
      //抛异常
//      throw new RuntimeException
    val reader = new FileReader("data/student.txt")

    }catch {
      case e:FileNotFoundException => println("找不到文件的异常")
      case e:RuntimeException => println("运行时异常")
      case _ => println("其他异常")
    }finally {
      println("都会执行")
    }
  }
}
